package com.woniuxy01;

import java.io.*;

/**
 * @author 作者
 * @create 2025-08-05 14:17
 */
public class Test01 {
    public static void main(String[] args) throws IOException, ClassNotFoundException {
        //基本功能的字节流
        FileOutputStream fileOutputStream = new FileOutputStream("");

        //带缓冲区的字节流
        BufferedOutputStream bos =
                new BufferedOutputStream(new FileOutputStream(""));
        //字符流：转换流
        OutputStreamWriter osw1=new OutputStreamWriter(new FileOutputStream(""),"utf-8");
        OutputStreamWriter osw2=
                new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream("")));

        //字符流：FileWriter
        FileWriter fw=new FileWriter("");

        //带缓冲区的字符流
        BufferedWriter bw1=new BufferedWriter(new FileWriter(""));
        BufferedWriter bw2=new BufferedWriter(
                new OutputStreamWriter(new BufferedOutputStream(new FileOutputStream(""))));

    }

    private static void load() throws IOException, ClassNotFoundException {
        ObjectInputStream ois=new ObjectInputStream(new FileInputStream("student.bin"));
        Student s1 = (Student) ois.readObject();
        System.out.println(s1);
    }

    private static void save() throws IOException {
        Student s1 = new Student(1,"zs","zs",11,"zs@163.com","13512345678","description001",new MyClass(1,"class001"));
        ObjectOutputStream oos =
                new ObjectOutputStream(new FileOutputStream("student.bin"));
        //保存对象的数据
        oos.writeObject(s1);
        oos.close();
    }
}
